package com.cookie.controller;

import com.alibaba.fastjson.JSON;
import com.baomidou.mybatisplus.mapper.EntityWrapper;
import com.cookie.entity.HistoryPaper;
import com.cookie.service.HistoryPaperService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * @author : cookie ✌️
 * @date : 2018/10/1 20:33
 */
@RestController
@RequestMapping("wx/api/hpaper")
public class ApiHistoryPaperController {
    @Autowired
    private HistoryPaperService historyPaperService;

    @GetMapping("list")
    public String list(String userId) {
        List<HistoryPaper> historyPapers = historyPaperService.selectList(new EntityWrapper<HistoryPaper>().eq("user_id", userId));
        return JSON.toJSONString(historyPapers);
    }
}
